<?php

namespace App\Http\Controllers;

use App\Models\User;
use Illuminate\Http\Request;

class PagesController extends Controller
{
    public function root()
    {

        $users=User::where('age','>',20);
        return view('pages.root',[
            'login' => $login = old('mobile', old('name', old('id', ''))),
            'errorUsername' => username($login),]);
    }

    public function lesson()
    {
        return view('lessons.list');
    }
    public function lessonDetails()
    {
        return view('lessons.details');
    }
    public function permissionDenied()
    {
        // 如果当前用户有权限访问后台，直接跳转访问
        if (config('administrator.permission')()) {
            return redirect(url(config('administrator.uri')), 302);
        }
        // 否则使用视图
        return view('pages.permission_denied');
    }
}
